package cn.hackcloud.designpattern.composite;

import java.util.ArrayList;
import java.util.List;

public class University extends OrganizationComponent {
	List<OrganizationComponent> organizationComponents = new ArrayList<OrganizationComponent>();

	public University(String name, String desc) {
		super(name, desc);
	}

	@Override
	void print() {
		System.err.println("----------------"+getName() + "-" + getDesc()+"-----------------");
		organizationComponents.forEach(x -> {
			x.print();
		});
	}

	@Override
	void add(OrganizationComponent organizationComponent) {
		organizationComponents.add(organizationComponent);
	}

	@Override
	void remove(OrganizationComponent organizationComponent) {
		organizationComponents.remove(organizationComponent);
	}

}
